#include<bits/stdc++.h>
#define fast_cin() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
// long long int n,m,k,flag=0,sz=0,v[51][51],dx[]={0,0,0,1},dy[]={1,0,0,0};
// string s[51];
// vector<pair<long long int,pair<long long int,long long int>>>vv;
// void dfschng(long long int x,long long int y)
// {
// if(x<0 || y<0 || x>=n || y>=m)
// {
// return;
// }
// if(v[x][y] || s[x][y]=='*')
// {
// return;
// }
// //cout<<x<<" "<<y<<"\n";
// v[x][y]=1;s[x][y]='*';
// for(long long int i=0;i<4;i++)
// {
// long long int xx=x+dx[i],yy=y+dy[i];
// dfschng(xx,yy);
// }
// }
// void dfs(long long int x,long long int y)
// {
// if(x<0 || y<0 || x>=n || y>=m)
// {
// return;
// }
// if(v[x][y] || s[x][y]=='*')
// {
// return;
// }
// v[x][y]=1;sz++;
// if(x==0 || y==0 || x==(n0) || y==(m0))
// {
// flag=1;
// }
// for(long long int i=0;i<4;i++)
// {
// long long int xx=x+dx[i],yy=y+dy[i];
// dfs(xx,yy);
// }
// }
// long long int n;
// cin>>n;
// for(long long int i=1;i<=n;i+=2)
// {
// cout<<i<<" ";
// }
// for(long long int i=n-(n&1);i>=1;i-=2)
// {
// cout<<i<<" ";
// }
// cout<<"\n";
void solve()
{
long long int n,cnt=0,op=0;
n=10;
string ss[10];
for(auto&s:ss)
{
cin>>s;
}
//horizontal
for(long long int i=0;i<n;i++)
{
for(long long int j=0;j<=5;j++)
{
cnt=0;
for(long long int k=j;k<j+5;k++)
{
cnt+=(ss[i][k]=='X')-(ss[i][k]=='O');
}
if(cnt==4)
{
op=1;break;
}
}
if(op)
{
break;
}
}
if(op)
{
cout<<"YES";return;
}
//verticle
for(long long int j=0;j<n;j++)
{
for(long long int i=0;i<=5;i++)
{
cnt=0;
for(long long int k=i;k<i+5;k++)
{
cnt+=(ss[k][j]=='X')-(ss[k][j]=='O');
}
if(cnt==4)
{
op=1;break;
}
}
if(op)
{
break;
}
}
if(op)
{
cout<<"YES";return;
}
for(long long int i=0;i<=5;i++)
{
for(long long int j=0;j<=5;j++)
{
cnt=0;
for(long long int k=0;k<5;k++)
{
cnt+=(ss[i+k][j+k]=='X')-(ss[i+k][j+k]=='O');
}
if(cnt==4)
{
op=1;break;
}
}
if(op)
{
break;
}
}
if(op)
{
cout<<"YES";return;
}
for(long long int i=0;i<=5;i++)
{
for(long long int j=4;j<n;j++)
{
cnt=0;
for(long long int k=0;k<5;k++)
{
cnt+=(ss[i+k][j-k]=='X')-(ss[i+k][j-k]=='O');
}
if(cnt==4)
{
op=1;break;
}
}
if(op)
{
break;
}
}
if(op)
{
cout<<"YES";return;
}
cout<<"NO";
}
int main()
{
fast_cin();
long long int t;
//cin>>t;
t=1;
while(t--)
{
solve();
}
return 0;
}
1405A - Permutation Forgery | 1733A - Consecutive Sum |
1733B - Rule of League | 1733C - Parity Shuffle Sorting |
1264A - Beautiful Regional Contest | 1695A - Subrectangle Guess |
467B - Fedor and New Game | 252C - Points on Line |
735C - Tennis Championship | 992A - Nastya and an Array |
554A - Kyoya and Photobooks | 79B - Colorful Field |
265B - Roadside Trees (Simplified Edition) | 1362C - Johnny and Another Rating Drop |
1214C - Bad Sequence | 1091B - New Year and the Treasure Geolocation |
244A - Dividing Orange | 1061C - Multiplicity |
1312A - Two Regular Polygons | 801A - Vicious Keyboard |
510B - Fox And Two Dots | 616D - Longest k-Good Segment |
1604A - Era | 555B - Case of Fugitive |
551A - GukiZ and Contest | 1399F - Yet Another Segments Subset |
1371C - A Cookie for You | 430B - Balls Game |
1263A - Sweet Problem | 1332B - Composite Coloring |